package main

import "fmt"

func bubblesort(nums []int){
	l:=len(nums)
	for i:=0;i<l-1;i++{
		doswap:=false
		for j:=0;j<l-1-i;j++{
			if nums[j] > nums[j+1]{
				nums[j],nums[j+1] = nums[j+1],nums[j]
				doswap = true
			}
		}
		
		if !doswap{
			return
		}
	}
}

func main() {
	nums := []int{3, 6, 2, 1, 6, 9}
	bubblesort(nums)
	fmt.Println(nums)
}
